import { rules } from '@by-l/react-form';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';

const reactt = react({
  babel: {
    plugins: [
      // 传统装饰器配置
      [
        '@babel/plugin-proposal-decorators',
        {
          legacy: true, // 关键参数
        },
      ],
      // 支持类属性
      [
        '@babel/plugin-proposal-class-properties',
        {
          loose: true,
        },
      ],
    ],
  },
});

// https://vite.dev/config/
export default defineConfig({
  plugins: [reactt],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src'),
    },
  },
});
